import Mock from 'mockjs';

// Mock.mock('http://127.0.0.1:5000/api/login', {
//   status: 200,
//   msg: '登录成功',
//   token: 'dhawjoldw',
//   userInfo: {
//     userName: '张三',
//   },
// });

let routerRender1 = [
  {
    path: '/home',
    name: 'home',
    component: 'Home.vue',
    redirect: '/home/merchants/welcome',
    children: [
      {
        path: 'merchants/welcome',
        name: 'welcome',
        component: 'merchants/Welcome.vue',
        meta: {
          title: '主页',
          isShow: 1,
          icon: 'icon-shouye',
        },
      },
      {
        path: 'merchants/enter',
        name: 'enter',
        component: 'merchants/Enter/Enter.vue',
        meta: {
          title: '立即入驻',
          isShow: 1,
          icon: 'icon-ruzhu',
        },
      },
      {
        path: 'merchants/enterprise',
        name: 'enterprise',
        component: 'merchants/Enter/enterprise/Enterprise.vue',
        meta: {
          title: '企业信息',
          isShow: 0,
        },
      },
      {
        path: 'merchants/collection',
        name: 'collection',
        component: 'merchants/Enter/enterprise/Collection.vue',
        meta: {
          title: '收款信息',
          isShow: 0,
        },
      },
      {
        path: 'merchants/audit',
        name: 'audit',
        component: 'merchants/Enter/enterprise/Audit.vue',
        meta: {
          title: '审核信息',
          isShow: 0,
        },
      },
      {
        path: 'merchants/order',
        name: 'order',
        component: 'merchants/Order/Order.vue',
        meta: {
          title: '订单管理',
          isShow: 1,
          icon: 'icon-dingdanguanli35',
        },
      },
      {
        path: 'merchants/service',
        name: 'service',
        component: 'merchants/Service/Service.vue',
        meta: {
          title: '服务管理',
          isShow: 1,
          icon: 'icon-fuwuguanli',
        },
      },

      // 以下是服务管理其他页面的路由跳转配置
      {
        path: 'merchants/serviceDetail',
        name: 'serviceDetail',
        component: 'merchants/Service/ServiceDetail.vue',
        meta: {
          title: '服务详情' /* 服务管理中的服务详情 */,
          isShow: 0,
        },
      },
      {
        path: 'merchants/serviceAdd',
        name: 'serviceAdd',
        component: 'merchants/Service/ServiceAdd.vue',
        meta: {
          title: '新增服务' /* 服务管理中的新增服务 */,
          isShow: 0,
        },
      },
      {
        path: 'merchants/serviceEdit',
        name: 'serviceEdit',
        component: 'merchants/Service/ServiceEdit.vue',
        meta: {
          title: '编辑服务' /* 服务管理中的编辑服务 */,
          isShow: 0,
        },
      },

      {
        path: 'merchants/financial',
        name: 'financial',
        component: 'merchants/Financial/Financial.vue',
        meta: {
          title: '财务管理',
          isShow: 1,
          icon: 'icon-caiwuguanli',
        },
      },
      {
        path: 'merchants/storeSet',
        name: 'storeSet',
        component: 'merchants/StoreSet/StoreSet.vue',
        meta: {
          title: '门店设置',
          isShow: 1,
          icon: 'icon-mendianguanli',
        },
      },
      {
        path: 'merchants/puditprise',
        name: 'puditprise',
        component: 'merchants/StoreSet/AuditPrise.vue',
        meta: {
          title: '等待审核',
          isShow: 0,
        },
      },
      {
        path: 'merchants/changeenterprise',
        name: 'changeenterprise',
        component: 'merchants/StoreSet/ChangeEnterprise.vue',
        meta: {
          title: '修改企业信息',
          isShow: 0,
        },
      },

      {
        path: 'merchants/changemoney',
        name: 'changemoney',
        component: 'merchants/StoreSet/ChangeMoney.vue',
        meta: {
          title: '修改收款信息',
          isShow: 0,
        },
      },

      {
        path: 'merchants/orderz/orderd',
        name: 'orderDetails',
        component: 'merchants/Order/Orderz/Orderd.vue',
        meta: {
          title: '待支付',
          isShow: 0,
        },
      },
      {
        path: 'merchants/orderz/orderf',
        name: 'orderfuwu',
        component: 'merchants/Order/Orderz/Orderf.vue',
        meta: {
          title: '待服务',
          isShow: 0,
        },
      },
      {
        path: 'merchants/orderz/orderwc',
        name: 'orderwc',
        component: 'merchants/Order/Orderz/Orderwc.vue',
        meta: {
          title: '已完成',
          isShow: 0,
        },
      },
      {
        path: 'merchants/orderz/ordert',
        name: 'ordert',
        component: 'merchants/Order/Orderz/Ordert.vue',
        meta: {
          title: '退款中',
          isShow: 0,
        },
      },
      {
        path: 'merchants/orderz/ordertk',
        name: 'ordertk',
        component: 'merchants/Order/Orderz/Ordertk.vue',
        meta: {
          title: '已退款',
          isShow: 0,
        },
      },
      {
        path: 'merchants/orderz/orderq',
        name: 'orderq',
        component: 'merchants/Order/Orderz/Orderq.vue',
        meta: {
          title: '已取消',
          isShow: 0,
        },
      },
    ],
  },
  {
    path: '/*',
    redirect: '/404',
  },
];

let routerRender2 = [
  {
    path: '/home',
    name: 'home',
    component: 'Home.vue',
    redirect: '/home/welcome',
    children: [
      {
        path: 'welcome',
        name: 'welcome',
        component: 'platform/Welcome.vue',
        meta: {
          title: '主页',
          isShow: 1,
          icon: 'icon-shouye',
        },
      },
      {
        path: 'audit',
        name: 'audit',
        component: 'platform/Audit/Audit.vue',
        meta: {
          title: '入驻审核',
          isShow: 1,
          icon: 'icon-SQLshenhe',
        },
      },
      {
        path: 'auditDetail',
        name: 'auditDetail',
        component: 'platform/Audit/AuditDetail.vue',
        meta: {
          title: '入驻审核详情',
          isShow: 0,
        },
      },
      {
        path: 'user',
        name: 'user',
        redirect: '/home/user/beauty',
        meta: {
          title: '用户管理',
          isShow: 1,
          icon: 'icon-yonghuguanli',
        },
        component: 'platform/user/User.vue',
        children: [
          {
            path: 'beauty',
            name: 'beauty',
            component: 'platform/user/BeautyTherapist.vue',
            meta: {
              title: '美疗师管理',
              isShow: 1,
              icon: 'icon-nvshangjia',
            },
          },
          {
            path: 'consumer',
            name: 'consumer',
            component: 'platform/user/Consumer.vue',
            meta: {
              title: '消费者管理',
              isShow: 1,
              icon: 'icon-xiaofeizheguanli',
            },
          },
          {
            path: '/ConsumerDetails',
            name: 'ConsumerDetails',
            component: 'platform/user/store/ConsumerDetails.vue',
            meta: {
              title: '消费者详情',
              isShow: 0,
            },
          },
          {
            path: 'store',
            name: 'store',
            component: 'platform/user/store/Store.vue',
            meta: {
              title: '门店管理',
              isShow: 1,
              icon: 'icon-mendianguanli',
            },
          },
          {
            path: 'details',
            name: 'details',
            component: 'platform/user/store/details.vue',
            meta: {
              title: '门店详情',
              isShow: 0,
            },
          },
        ],
      },
      {
        path: 'order',
        name: 'order',
        component: 'platform/Order/Order.vue',
        meta: {
          title: '订单管理',
          isShow: 1,
          icon: 'icon-dingdanguanli35',
        },
      },
      {
        path: 'platform/orderz/orderz',
        name: 'orderDetails',
        component: 'platform/Order/Orderz/Orderz.vue',
        meta: {
          title: '待支付',
          isShow: 0,
        },
      },
      {
        path: 'platform/orderz/orderdr',
        name: 'orderdr',
        component: 'platform/Order/Orderz/Orderdr.vue',
        meta: {
          title: '待确认',
          isShow: 0,
        },
      },
      {
        path: 'platform/orderz/orderfw',
        name: 'orderfw',
        component: 'platform/Order/Orderz/Orderfw.vue',
        meta: {
          title: '待服务',
          isShow: 0,
        },
      },
      {
        path: 'platform/orderz/orderwc',
        name: 'orderwc',
        component: 'platform/Order/Orderz/Orderwc.vue',
        meta: {
          title: '已完成',
          isShow: 0,
        },
      },
      {
        path: 'platform/orderz/orderqx',
        name: 'orderqx',
        component: 'platform/Order/Orderz/Orderqx.vue',
        meta: {
          title: '已取消',
          isShow: 0,
        },
      },
      {
        path: 'platform/orderz/ordert',
        name: 'ordert',
        component: 'platform/Order/Orderz/Ordert.vue',
        meta: {
          title: '退款中',
          isShow: 0,
        },
      },
      {
        path: 'platform/orderz/ordertk',
        name: 'ordertk',
        component: 'platform/Order/Orderz/Ordertk.vue',
        meta: {
          title: '已退款',
          isShow: 0,
        },
      },
      {
        path: 'service',
        name: 'service',
        component: 'platform/Service/ServiceIndex.vue',
        meta: {
          title: '服务管理',
          isShow: 1,
          icon: 'icon-fuwuguanli',
        },
        children: [
          {
            path: 'service',
            name: 'service',
            component: 'platform/Service/Service.vue',
            meta: {
              title: '服务管理',
              isShow: 1,
              icon: 'icon-fuwuguanli',
            },
          },
          {
            path: 'sensitive',
            name: 'sensitive',
            component: 'platform/Service/Sensitive.vue',
            meta: {
              title: '敏感词管理',
              isShow: 1,
              icon: 'icon-minganci',
            },
          },
        ],
      },
      {
        path: 'financial',
        name: 'financial',
        component: 'platform/Financial/FinancialIndex.vue',
        meta: {
          title: '财务管理',
          isShow: 1,
          icon: 'icon-caiwuguanli',
        },
        children: [
          {
            path: 'financial',
            name: 'financial',
            component: 'platform/Financial/Financial.vue',
            meta: {
              title: '财务管理',
              isShow: 1,
              icon: 'icon-caiwuguanli',
            },
          },
          {
            path: 'settlement',
            name: 'settlement',
            component: 'platform/Financial/Settlement.vue',
            meta: {
              title: '结算设置',
              isShow: 1,
              icon: 'icon-caiwuguanli',
            },
          },
        ],
      },
      {
        path: 'permissions',
        name: 'permissions',
        meta: {
          title: '权限管理',
          isShow: 1,
          icon: 'icon-shenqingquanxian',
        },
        component: 'platform/Permissions/Permissions.vue',
      },
      {
        path: 'evaluation',
        name: 'evaluation',
        component: 'platform/Evaluation/Evaluation.vue',
        meta: {
          title: '评价管理',
          isShow: 1,
          icon: 'icon-weiyuejin',
        },
      },
    ],
  },
  {
    path: '/*',
    redirect: '/404',
  },
];

Mock.mock('http://127.0.0.1:8080/api/login', 'post', function (config) {
  let req = JSON.parse(config.body);
  if (req.type === '1') {
    return Mock.mock({
      status: 200,
      msg: '登录成功',
      token: 'dhawjoldw',
      userInfo: {
        userName: '张三',
      },
      routerList: routerRender1,
    });
  } else if (req.type === '0') {
    return Mock.mock({
      status: 200,
      msg: '登录成功',
      token: 'dhawjoldw',
      userInfo: {
        userName: '张三',
      },
      routerList: routerRender2,
    });
  }
});

let roleData = [
  {
    consumer_login_phone: '17334035196',
    consumer_status: 0,
    shop_name: '九江',
    customer_id: '1',
    consumer_nickname: '龚嘉懿',
  },
  {
    consumer_login_phone: '17713688234',
    consumer_status: 1,
    shop_name: '枣庄',
    customer_id: '2',
    consumer_nickname: '邵昊然',
  },
  {
    consumer_login_phone: '15082849822',
    consumer_status: 0,
    shop_name: '廊坊',
    customer_id: '3',
    consumer_nickname: '梁琪',
  },
  {
    consumer_login_phone: '15551840288',
    consumer_status: 0,
    shop_name: '本溪',
    customer_id: '4',
    consumer_nickname: '万健柏',
  },
  {
    consumer_login_phone: '15846257287',
    consumer_status: 1,
    shop_name: '无锡',
    customer_id: '5',
    consumer_nickname: '龚正豪',
  },
  {
    consumer_login_phone: '15102035806',
    consumer_status: 0,
    shop_name: '连云港',
    customer_id: '6',
    consumer_nickname: '彭弘文',
  },
  {
    consumer_login_phone: '17221379867',
    consumer_status: 0,
    shop_name: '株洲',
    customer_id: '7',
    consumer_nickname: '蒋修洁',
  },
  {
    consumer_login_phone: '17521589421',
    consumer_status: 0,
    shop_name: '镇江',
    customer_id: '8',
    consumer_nickname: '田懿轩',
  },
  {
    consumer_login_phone: '17827791097',
    consumer_status: 1,
    shop_name: '聊城',
    customer_id: '9',
    consumer_nickname: '袁明哲',
  },
  {
    consumer_login_phone: '17706691603',
    consumer_status: 0,
    shop_name: '平顶山',
    customer_id: '10',
    consumer_nickname: '侯嘉懿',
  },
  {
    consumer_login_phone: '17740830786',
    consumer_status: 0,
    shop_name: '邢台',
    customer_id: '11',
    consumer_nickname: '罗志泽',
  },
  {
    consumer_login_phone: '17372026401',
    consumer_status: 0,
    shop_name: '北京',
    customer_id: '12',
    consumer_nickname: '沈熠彤',
  },
  {
    consumer_login_phone: '17740680306',
    consumer_status: 0,
    shop_name: '唐山',
    customer_id: '13',
    consumer_nickname: '袁展鹏',
  },
  {
    consumer_login_phone: '17348994675',
    consumer_status: 1,
    shop_name: '鄂尔多斯',
    customer_id: '14',
    consumer_nickname: '董烨华',
  },
  {
    consumer_login_phone: '17032137884',
    consumer_status: 1,
    shop_name: '拉萨',
    customer_id: '15',
    consumer_nickname: '莫文博',
  },
  {
    consumer_login_phone: '17782707303',
    consumer_status: 0,
    shop_name: '承德',
    customer_id: '16',
    consumer_nickname: '余建辉',
  },
  {
    consumer_login_phone: '13063131153',
    consumer_status: 1,
    shop_name: '南充',
    customer_id: '17',
    consumer_nickname: '林昊然',
  },
  {
    consumer_login_phone: '17509124733',
    consumer_status: 0,
    shop_name: '大庆',
    customer_id: '18',
    consumer_nickname: '陶远航',
  },
  {
    consumer_login_phone: '17052694578',
    consumer_status: 1,
    shop_name: '自贡',
    customer_id: '19',
    consumer_nickname: '莫梓晨',
  },
  {
    consumer_login_phone: '15819015506',
    consumer_status: 0,
    shop_name: '绵阳',
    customer_id: '20',
    consumer_nickname: '许晓啸',
  },
];

Mock.mock('http://127.0.0.1:8080/role', 'get', {
  status: 200,
  roleData: roleData,
});

Mock.mock('http://127.0.0.1:8080/changeSwitch', 'post', {
  status: 200,
  msg: '提交成功',
});

Mock.mock('http://127.0.0.1:8080/editRole', 'post', {
  status: 200,
  msg: '编辑成功',
});
